<%-- 
    Document   : home
    Created on : Apr 10, 2012, 9:52:48 AM
    Author     : Yudi Retanto
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<jsp:include page="../header.jsp"></jsp:include>
    <!-- Container -->
    <script type="text/javascript">
        function updateProvinsi(){
            var id = $("#s-provinsi").val();
            if (id>0){
                $("#s-kabupaten").load("./admin?action=ajax&data=kabupaten&id_prov="+id);
            }
        }
    </script>
    <div id="container">
        <div class="shell">
            <!-- Main -->
            <div id="main">
                <div class="cl">&nbsp;</div>
                <!-- Content -->
                <div id="content">
                    <!-- Box -->
                    <div class="box">
                        <!-- Box Head -->
                        <div class="box-head">
                            <h2 class="left">Daftar Unit Surveilans</h2>
                        </div>
                        <!-- End Box Head -->	
                        <!-- Table -->
                        <div class="table">
                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <th>No</th>
                                    <th>Nama Unit</th>
                                    <th>Provinsi</th>
                                    <th>Kabupaten</th>
                                    <th>Alamat</th>
                                    <th width="110" class="ac">Pengaturan</th>
                                </tr>
                                <c:forEach items="${unit}" var="u">
                                    <c:set var="ordinal" value="${ordinal + 1}" />
                                    <tr <c:if test="${(ordinal%2) == 1}">class="odd"</c:if>>
                                        <td>${ordinal}</td>
                                        <td><h3><a href="#">${u.getNama()}</a></h3></td>
                                        <td>${u.getProvinsi_name()}</td>
                                        <td>${u.getKabupaten_name()}</td>
                                        <td>${u.getAlamat()}</td>
                                        <td>
                                            <a href="./admin?action=delete_unit&id=${u.getId()}" class="ico del">Delete</a>
                                            <a href="./admin?action=edit_unit&id=${u.getId()}" class="ico edit">Edit</a>
                                        </td>
                                    </tr>
                                </c:forEach>
                            </table>
                            <!-- Pagging 
                            <div class="pagging">
                                <div class="left">Showing 1-12 of 44</div>
                                <div class="right">
                                    <a href="#">Previous</a>
                                    <a href="#">1</a>
                                    <a href="#">2</a>
                                    <a href="#">3</a>
                                    <a href="#">4</a>
                                    <a href="#">245</a>
                                    <span>...</span>
                                    <a href="#">Next</a>
                                    <a href="#">View all</a>
                                </div>
                            </div>
                            <!-- End Pagging -->
                        </div>
                        <!-- Table -->
                    </div>
                    <!-- End Box -->
                    
                    <!-- Box -->
                    <div class="box">
                        <!-- Box Head -->
                        <div class="box-head">
                            <h2>Tambah Unit Surveilans</h2>
                        </div>
                        <!-- End Box Head -->
                        <form action="./admin?action=add_unit" method="post">
                            <!-- Form -->
                            <div class="form">
                                <p>
                                    <label>Nama Unit</label>
                                    <input type="text" class="field size1" name="nama"/>
                                </p>
                                <p class="inline-field">
                                    <label>Provinsi</label>
                                    <select id="s-provinsi" onchange="updateProvinsi()" class="field" name="prov">
                                        <option value="0">-- Provinsi -- &nbsp</option>
                                        <c:forEach items="${provinsi}" var="p">
                                            <option value="${p.getId()}">${p.getNama()}</option>
                                        </c:forEach>
                                    </select>
                                </p>
                                <p class="inline-field">
                                    <label>Kabupaten</label>
                                    <select class="field" id="s-kabupaten" name="kab">
                                        <option value="0">-- Kabupaten -- &nbsp</option>
                                    </select>
                                </p>
                                <p>
                                    <label>Alamat</label>
                                    <input type="text" class="field size1" name="alamat"/>
                                </p>
                                <p>
                                    <label>Username Sistem</label>
                                    <input type="text" class="field size1" name="user"/>
                                </p>
                                <p>
                                    <label>Password Sistem</label>
                                    <input type="text" class="field size1" name="pwd"/>
                                </p>
                            </div>
                            <!-- End Form -->
                            <!-- Form Buttons -->
                            <div class="buttons">
                                <input type="submit" class="button" value="submit" />
                            </div>
                            <!-- End Form Buttons -->
                        </form>
                    </div>
                    <!-- End Box -->
                </div>
                <!-- End Content -->
                <div class="cl">&nbsp;</div>			
            </div>
            <!-- Main -->
        </div>
    </div>
    <!-- End Container -->
<jsp:include page="../footer.jsp"></jsp:include>